package com.apartment.own.mapper;

import java.util.List;
import java.util.Map;
import java.util.Set;

import com.apartment.own.domain.OwnResHouseResource;
import com.apartment.own.response.common.ExitCityResp;
import com.apartment.own.response.res.HouseSelectResponse;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 房源Mapper接口
 *
 * @author @Dog_E
 * @date 2020-08-28
 */
public interface OwnResHouseResourceMapper extends BaseMapper<OwnResHouseResource> {
    /**
     * 查询房源
     *
     * @param id 房源ID
     * @return 房源
     */
    public OwnResHouseResource selectOwnResHouseResourceById(Long id);

    /**
     * 查询房源列表
     *
     * @param ownResHouseResource 房源
     * @return 房源集合
     */
    public List<OwnResHouseResource> selectOwnResHouseResourceList(OwnResHouseResource ownResHouseResource);

    /**
     * 新增房源
     *
     * @param ownResHouseResource 房源
     * @return 结果
     */
    public int insertOwnResHouseResource(OwnResHouseResource ownResHouseResource);

    /**
     * 修改房源
     *
     * @param ownResHouseResource 房源
     * @return 结果
     */
    public int updateOwnResHouseResource(OwnResHouseResource ownResHouseResource);

    /**
     * 删除房源
     *
     * @param id 房源ID
     * @return 结果
     */
    public int deleteOwnResHouseResourceById(Long id);

    /**
     * 批量删除房源
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteOwnResHouseResourceByIds(Long[] ids);

    /**
     * 查询城市列表（已有房源城市）
     *
     * @return
     */
    @Select("select distinct city_value,city_id from own_res_house_resource")
    public List<ExitCityResp> selectExistCity();

    /**
     * 查询已有小区
     * @return
     */
    @Select("select distinct housing_estate from own_res_house_resource ${ew.customSqlSegment}")
    public List<String> listExistPlot( @Param(Constants.WRAPPER) Wrapper wrapper);
}
